#!/bin/bash

#RS=''
num=$1
RS=" -rs $2 "
DEBUG='  '
#DEBUG=' -d r '

for (( i = 0;i < $num; i++ )); do
#for i in $(seq 0 $num); do
    echo "server $i"
    j=`expr $i + 100` 
    ../network/nachos -m $j -n $num -server $DEBUG $RS & 
    echo "../network/nachos -m $j -n $num -server $DEBUG $RS &"
    sleep 1
done

#../network/nachos -m 100 -n $num -server -d r $RS &
#../network/nachos -m 101 -n $num -server -d r $RS &

../network/nachos -m 6 -n $num -x ../test/createinit $RS    &
sleep 80

echo "over"
../network/nachos -m 1 -n $num -x ../test/createcc1 $DEBUG $RS  &
echo "../network/nachos -m 1 -n $num -x ../test/createcc1 $DEBUG $RS  &"
../network/nachos -m 2 -n $num -x ../test/createcc2 $DEBUG $RS &
echo "../network/nachos -m 2 -n $num -x ../test/createcc2 $DEBUG $RS &"
../network/nachos -m 5 -n $num -x ../test/createcc3 $DEBUG $RS &
echo "../network/nachos -m 5 -n $num -x ../test/createcc3 $DEBUG $RS &"
../network/nachos -m 3 -n $num -x ../test/createtccc $DEBUG $RS &
echo "../network/nachos -m 3 -n $num -x ../test/createtccc $DEBUG $RS &"
../network/nachos -m 4 -n $num -x ../test/createmtttmm $DEBUG $RS &
echo "../network/nachos -m 4 -n $num -x ../test/createmtttmm $DEBUG $RS &"
